/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exatrez.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Mansur
 */
@Entity
@Table(name = "ref_sv_header")
@NamedQueries({
    @NamedQuery(name = "RefShipVisitHeader.findAll", query = "SELECT s FROM RefShipVisitHeader s")})
public class RefShipVisitHeader implements Serializable{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ref_sh_id")
    private Integer refShipVisitHeaderId;
    
    @Column(name = "description")
    private String description;
    
    @Column(name = "input_type")
    private String inputType;  // S=Single Line, M=Multiple Line
    
    @Column(name = "active_flag")
    private String activeFlag;  // A=Active, I=In-active
    
    @Column(name = "order_flag")
    private Integer orderFlag;
    
    @Embedded
    private InfoAudit infoAudit;
    
    public RefShipVisitHeader(){
        
    }

    public Integer getRefShipVisitHeaderId() {
        return refShipVisitHeaderId;
    }

    public void setRefShipVisitHeaderId(Integer refShipVisitHeaderId) {
        this.refShipVisitHeaderId = refShipVisitHeaderId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getInputType() {
        return inputType;
    }

    public void setInputType(String inputType) {
        this.inputType = inputType;
    }

    public String getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(String activeFlag) {
        this.activeFlag = activeFlag;
    }

    public Integer getOrderFlag() {
        return orderFlag;
    }

    public void setOrderFlag(Integer orderFlag) {
        this.orderFlag = orderFlag;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (refShipVisitHeaderId != null ? refShipVisitHeaderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RefShipVisitHeader)) {
            return false;
        }
        RefShipVisitHeader other = (RefShipVisitHeader) object;
        if ((this.refShipVisitHeaderId == null && other.refShipVisitHeaderId != null) || (this.refShipVisitHeaderId != null && !this.refShipVisitHeaderId.equals(other.refShipVisitHeaderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "exatrez.model.RefShipVisitHeader[ refShipVisitHeaderId=" + refShipVisitHeaderId + " ]";
    }
    
    public List<RefShipVisitHeader> getListActiveHeader(){
        List<RefShipVisitHeader> l = new ArrayList<RefShipVisitHeader>();
        for (RefShipVisitHeader rsvh : l) {
            if(rsvh.getActiveFlag().equals("A")){ // for active only
                l.add(rsvh);
            }
        }
        return l;
    }
}
